import { Progress } from 'antd';
// import { getSaleSummary }

import './index.less';

const NestedChart = (props: any) => {
    const { today, month, month_finish_rate,  } = props;
    const formatStr = (key: any, percent: any) => {
        if (percent === 100) return `${(month_finish_rate || {})[key]}%`;
        return `${percent}%`;
    };

    return (
        <div className="sale-pie">
            <h4 className="sale-title">今日销售</h4>
            <span>{(today || {}).count || 0}单</span>
            <span>{(today || {}).amount || 0}元</span>
            <h4 className="sale-title">本月销售</h4>
            <span>{(month || {}).count || 0}单</span>
            <span style={{ marginBottom: '12px' }}>{(month || {}).amount || 0}元</span>
            <Progress
                type="circle"
                percent={(month_finish_rate || {}).count}
                format={(...args) => formatStr('count', args[0])}
            />
            <span className="progress-title">月度单量完成度数</span>
            <Progress
                type="circle"
                percent={(month_finish_rate || {}).amount}
                format={(...args) => formatStr('amount', args[0])}
            />
            <span className="progress-title">月度销售额完成度数</span>
        </div>
    );
};

export default NestedChart;
